<%--@elvariable id="password" type="com.doupi.partner.op.controller.AdminController.doAdminLogin"--%>
<%--@elvariable id="mobile" type="com.doupi.partner.op.controller.AdminController.doAdminLogin"--%>
<%--@elvariable id="errorMessage" type="com.doupi.partner.op.controller.AdminController.doAdminLogin"--%>
<%--@elvariable id="webRoot" type="com.doupi.partner.op.interceptor.OpFilter"--%>
<%@ page language="java" pageEncoding="UTF-8" %>
<%@ include file="common/tags.jsp" %>
<!DOCTYPE html>
<html>
<head lang="en">
    <%@ include file="common/assets.jsp" %>
    <style>
        .header {
            text-align : center;
        }

        .header h1 {
            font-size  : 200%;
            color      : #333;
            margin-top : 30px;
        }

        .header p {
            font-size : 14px;
        }
    </style>
</head>
<body>
<div class="header">
    <div class="am-g">
        <h1>
            <img src="${webRoot}/assets/images/logo_mp_hui.png"/>
        </h1>
        <label style="color: red">${errorMessage}</label>
    </div>
    <!--<hr/>-->
</div>
<div class="am-g">
    <div class="am-u-lg-6 am-u-md-8 am-u-sm-centered">
        <form method="post" class="am-form" action="${webRoot}/admin_index" id="logonForm" onSubmit="return doSubmit()">
            <input type="hidden" name="openId" id="openId" value="${openId}"/>
            <div style="width:100%; float:left; margin-top:0;"><br>
                <input type="text" name="mobile" id="userName" value="${mobile}" placeholder="请输入手机号码" autocomplete="off" autofocus="autofocus" style="width:100%; height:45px; border-radius:4px;"/>
            </div>
            <br>
            <div style="width:100%; float:left; margin-top:5%;">
                <input type="password" name="password" id="password" value="${password}" placeholder="请输入密码" style="width:100%; height:45px; border-radius:4px;"/>
            </div>
            <div style="width:100%; float:left; margin-top:5%;" class="am-form-inline">
                <div class="am-form-group" style="width: 68%; height:45px; margin-bottom:0px; float:left; overflow:hidden;">
                    <input type="text" name="code" id="validImgCode" placeholder="请输入图形验证码" style="width:100%; height:45px; border-radius:4px;"/>
                </div>
                <div class="am-form-group" style="width: 30%; height:45px; margin-bottom:0px; float: right; overflow:hidden;">
                    <img alt="验证码" src="${webRoot}/util/imageCode?cacheKey=1" id="validImg" style="width: 100%; height:45px; float: right; overflow:hidden; border-radius:4px;"/>
                </div>
            </div>
            <div style="width:100%; float:left; margin-top:8%;" class="am-cf">
                <input type="submit" value="登 录" class="am-btn am-btn-primary am-btn-sm am-fl" id="logonButton" style="width:100%; height:45px; border-radius:4px; font-size:18px;"/>
            </div>
        </form>
    </div>
</div>
<script src="${webRoot}/assets/ui/amazeui/js/jquery.min.js"></script>
<script src="${webRoot}/assets/ui/amazeui/js/amazeui.min.js"></script>
<script type="text/javascript">
    $(function () {
        var userName = localStorage.getItem('OP_LOGIN_USER');

        if (userName) {
            $('#userName').val(userName);
            $('#remember-me').attr('checked', 'checked');
        }

        $('#validImg').click(function () {
            $(this).attr('src', "${webRoot}/util/imageCode?cacheKey=" + new Date().getTime());
        });
    });

    function doSubmit() {
        var checked = $('#remember-me').get(0).checked;
        if (checked) {
            localStorage.setItem('OP_LOGIN_USER', $('#userName').val());
        } else {
            localStorage.removeItem('OP_LOGIN_USER');
        }
        return true;
    }
</script>
</body>
</html>
